import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:honeypotflutter/public/public_baseState.dart';
import 'package:honeypotflutter/public/public_storage.dart';
import 'package:honeypotflutter/publicBussine/bussine_colors.dart';
import 'package:honeypotflutter/public/public_total.dart';
import 'package:honeypotflutter/router/bussine_router.dart';
import 'package:honeypotflutter/router/bussine_router_url.dart';

void main() {
  WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
  // FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
  initialization();
  runApp(const MyApp());
}

/*
* 初始化数据
* */
void initialization() async {
  /// 暂存
  HLStorage.initStorage();

  //启动图延时移除方法【延迟3秒】
  await Future.delayed(const Duration(seconds: 1));
  // FlutterNativeSplash.remove();
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      title: '蜜罐管家',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        scaffoldBackgroundColor: MGColors.backColor,
      ),
      defaultTransition: Transition.rightToLeft,
      builder: HLTotal.init(),
      getPages: MGRouter.routs,
      initialRoute: MGRouterUrl.index,
      navigatorObservers: [routeObserver],
    );
  }
}
